package com.xhs.controller;


import com.xhs.dto.request.SendHttpParam;
import com.xhs.message.ReturnResult;
import com.xhs.service.SendHttpService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * @desc:
 * @projectName: http-okhttps-app
 * @author: xhs
 * @date: 2024-06-10 15:12
 * @version: JDK 1.8
 */
@RestController
@RequestMapping("/sendHttp")
public class SendHttpController {

    @Resource
    private SendHttpService sendHttpService;

    /**
     * 发送Get请求
     *
     * @param param 入参
     * @return ReturnResult
     */
    @PostMapping("/sendGet")
    public ReturnResult<Object> sendGet(@Valid @RequestBody SendHttpParam param) {
        return sendHttpService.sendGet(param);
    }

    /**
     * 发送post请求
     *
     * @param param 入参
     * @return ReturnResult
     */
    @PostMapping("/sendPost")
    public ReturnResult<Object> sendPost(@Valid @RequestBody SendHttpParam param) {
        return sendHttpService.sendPost(param);
    }
}
